﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SelfService.Model.Interface;
using SelfService.XinXing.Controllers;
using SelfService.XinXing.Models;

namespace SelfService.XinXing
{
    public static class XinXingServiceExtension
    {
        public static void AddXinXingService(this IServiceCollection services, IConfiguration configRoot)
        {
            //注入配置文件
            services.Configure<ReservationConfig>(configRoot.GetSection("AppSettings"));
            //注入WebService
            services.AddSingleton(new AutoWebService.AutoWebServiceSoapClient(AutoWebService.AutoWebServiceSoapClient.EndpointConfiguration.AutoWebServiceSoap));
            services.AddSingleton(new AppWebService.AutoWebServiceSoapClient(AppWebService.AutoWebServiceSoapClient.EndpointConfiguration.AutoWebServiceSoap));
            //大屏数据队列
            services.AddScoped<IScreenQueueService, ScreenQueue>();
            //注入HIS缴费接口
            services.AddScoped<IHisOrder, Order>();
            //注入HIS用户接口
            services.AddScoped<IHisUser, User>();
            //注入聚合支付
            services.AddScoped<IPaySystem, XinXingPay>();
#if !DEBUG
            //支付结果查询服务
            services.AddHostedService<PayService>();
            //医生排班信息同步服务
            services.AddHostedService<DoctorScheduleDataSyncService>();
#endif
            //医技预约
            services.AddScoped<IInspectionControllerBase, InspectionControllerBase>();
            //门诊预约
            services.AddScoped<IClinicControllerBase, ClinicControllerBase>();
        }
    }
}
